package com.sqx.modules.banArea.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.banArea.entity.BanArea;
import com.sqx.modules.banArea.service.IBanAreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *  禁止区域-管理端
 *
 * @author wuChang
 * @since 2023-08-28
 */
@RestController
@Api(value = "禁止区域-管理端", tags = {"禁止区域-管理端"})
@RequestMapping("/admin/banArea/")
public class BanAreaController {
    @Autowired
    private IBanAreaService banAreaService;

    @ApiOperation("添加|修改禁止区域")
    @PostMapping("saveBanArea")
    public Result saveBanArea(@RequestBody BanArea banArea) {
        return banAreaService.saveBanArea(banArea);
    }

    @ApiOperation("获取禁止区域列表")
    @GetMapping("getBanAreaList")
    public Result getBanAreaList(Integer page, Integer limit, BanArea banArea) {
        return Result.success().put("data", banAreaService.getBanAreaList(page, limit, banArea));
    }

    @ApiOperation("树形结构禁止区域列表")
    @GetMapping("getBanAreaTreeList")
    public Result getBanAreaTreeList(Integer page, Integer limit, BanArea banArea) {
        return Result.success().put("data", banAreaService.getBanAreaTreeList(page, limit, banArea));
    }

    @ApiOperation("删除禁止区域")
    @GetMapping("deleteArea")
    public Result deleteArea(Long areaId) {
        return banAreaService.deleteArea(areaId);
    }

    @ApiOperation("修改区域状态")
    @GetMapping("updateAreaStatus")
    public Result updateAreaStatus(Long areaId) {
        return banAreaService.updateAreaStatus(areaId);
    }

}
